<template>
  <div class="body-box">
    <!-- 第三行数据 -->
    <div class="content-box2">
      <div class="one">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">车辆实时在线占比 </span>
            </div>
          </div>

          <div id="WorkOnStandard_VZ" style="width: 98%; height: 210px"></div>
        </dv-border-box-7>
      </div>
      <div class="two">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">昨日车辆出动占比 </span>
            </div>
          </div>

          <div id="WorkOnStandard_VC" style="width: 98%; height: 210px"></div>
        </dv-border-box-7>
      </div>
      <div class="four">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">各清运队昨日出动百分比</span>
            </div>
          </div>
          <div id="WorkOnStandard_GC" style="width: 98%; height: 420px"></div>
        </dv-border-box-7>
      </div>
      <div class="six">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">{{
                this.changeOperationName
              }}</span>
            </div>
          </div>
          <el-button-group style="position: absolute; right: 31%; z-index: 99">
            <el-button
              round
              type="primary"
              v-for="(item, index) in mapOperationsSummary"
              size="mini"
              :key="index"
              @click="changeOperationSummaryValue(index)"
              >{{ item.name }}
            </el-button>
          </el-button-group>


          <div
            :id="this.changeOperationValue"
            style="width: 98%; height: 420px"
          ></div>
        </dv-border-box-7>
      </div>
      <div class="seven">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">垃圾点位收运覆盖率</span>
            </div>
          </div>

          <div id="WorkOnStandard_LV" style="width: 98%; height: 420px"></div>
        </dv-border-box-7>
      </div>
      <div class="eight">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">各清运队实时在线百分比 </span>
            </div>
          </div>

          <div id="WorkOnStandard_GZ" style="width: 98%; height: 420px"></div>
        </dv-border-box-7>
      </div>
      <!-- <div class="ten">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">中转站垃圾车辆作业趟次 </span>
            </div>
          </div> 420px

          <div id="WorkOnStandard_ZV" style="width: 98%; height: 240px"></div>
        </dv-border-box-7>
      </div> -->
      
      <div class="ten">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
        <div style="width: 100%; height: 190px">
          <el-row :gutter="12" style="margin: 2% 0">
            <el-col :span="8">
              <el-card shadow="always">
                <div class="ht">车辆总数</div>
                <div class="hd">2103</div>
              </el-card>
            </el-col>
            <el-col :span="8">
              <el-card shadow="always" >
                <div class="ht">大车数</div>
                <div class="hd">1056</div>
              </el-card>
            </el-col>
            <el-col :span="8">
              <el-card shadow="always" >
                <div class="ht">小车数</div>
                <div class="hd">1047</div>
              </el-card>
            </el-col>
          </el-row>
          <el-row :gutter="12" style="margin: 2% 0">
            <el-col :span="8">
              <el-card shadow="always">
                <div class="ht">中转站数</div>
                <div class="hd">15</div>
              </el-card>
            </el-col>
            <el-col :span="8">
              <el-card shadow="always" >
                <div class="ht">处理厂数</div>
                <div class="hd">6</div>
              </el-card>
            </el-col>
            <el-col :span="8">
              <el-card shadow="always" >
                <div class="ht">垃圾点</div>
                <div class="hd">1231</div>
              </el-card>
            </el-col>
          </el-row>
        </div>
      </dv-border-box-7>
      </div>
      <div class="fourteen">
        <dv-border-box-7 :color="['#08304a', '#126e82']">
          <div class="d-flex pt-2 pl-2 title">
            <span>
              <icon name="chart-bar" class="text-icon"></icon>
            </span>
            <div class="d-flex">
              <span class="fs-xl text mx-2">前端处置单位情况统计 </span>
            </div>
          </div>
          <div id="WorkOnStandard_VY" style="width: 98%; height: 210px"></div>
        </dv-border-box-7>
      </div>
    </div>
  </div>
</template>

<script>
import { collectionRate } from '@/components/echart/bar.js'
import { collectionRate3 } from '@/components/echart/bar.js'
// import { incomingQuantity } from '@/components/echart/bar.js'
import { spotsNumbe } from '@/components/echart/bar.js'
import { spotsNumbeH1 } from '@/components/echart/bar.js'
import { spotsNumbe2 } from '@/components/echart/bar.js'
// import { brokenLine1 } from '@/components/echart/bar.js'
import drawMixin from "../utils/drawMixin";
import { formatTime } from '../utils/index.js'
import { formatDate } from '@/common/js/date.js'
import * as echarts from 'echarts';
export default {
  mixins: [drawMixin],
  data () {
    return {
      ClientNo: '00000',
      nowDate: formatDate(new Date(new Date().getTime() - 3600 * 1000 * 24), 'yyyy-MM-dd'),
      radio1: '上海',
      changeOperationName: "处理厂垃圾车辆作业趟次",
      changeOperationValue: "WorkOnStandard_CV",
      mapOperationsSummary: [
        
        {
          name: "处理厂",
          icon: "el-icon-house",
        },
        {
          name: "中转站",
          icon: "el-icon-house",
        },
      ],
      form: {
        userName: 'dlhw',
        date: '2020-10',
        clientNo: '00000',
        vehicleData: [{
          排队数: '0',
          车辆总数: '0',
          出动数: '0',
          出动率: '0',
        }],
      },
      MapV: {
        iconLayerDic: {},
        textLayerDic: {},
        dataSetDic: {},
        VIcon_Installations: {},
        VText_Installations: {},
      },
      Data: {
        arrayForType_Rubbish: [],
        arrayCLCPolygonData: [],
        arrayCLCMarkerData: [],
        arrayZZZMarkerData: [],
        arrayNCDMarkerData: [],
        arrayXQCYMarkerData: [],
        arrayCYMarkerData: [],
      },
      isZoomChange: 'S',
      map: null,
      mapZoom: 16,
      timing: null,
      loading: false,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
    }
  },
  components: {
    // centerLeft1,
    // centerLeft2,
    // centerRight1,
    // centerRight2,
    // center,
    // bottomLeft,
    // bottomRight
  },
  mounted () {
    // this.ClientNo = localStorage.getItem('ClientNo');
    this.initWorkOnStandard_VZ()
    this.initWorkOnStandard_VC()
    this.initWorkOnStandard_GC()
    this.initWorkOnStandard_GZ()
    this.initWorkOnStandard_CV()
    this.initWorkOnStandard_LV()
    this.initWorkOnStandard_ZV()
    this.initWorkOnStandard_VY()
    this.timeFn()
  },
  beforeDestroy () {
    clearInterval(this.timing)
  },
  methods: {
    // 实时车辆在线统计
    async initWorkOnStandard_VZ () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_VZ'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(collectionRate());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetPieMultipurposeN?sqlName=dlhw&url=exec T_GetRubbishOnlineInfo '" + this.ClientNo + "'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url)

      myChart.setOption({
        series: [{
          // data: data.series
          data: data
        },]
      });
    },
    // 昨日车辆出动占比
    async initWorkOnStandard_VC () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_VC'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(collectionRate());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetPieMultipurposeN?sqlName=dlhw&url=exec T_GetRubbishDistanceInfo  '" + this.nowDate + "','" + this.ClientNo + "'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url)

      myChart.setOption({
        series: [{
          // data: data.series
          data: data
        },]
      });
    },
    // 各清运队昨日出动百分比
    async initWorkOnStandard_GC () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_GC'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(spotsNumbeH1());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetT1BarMultipurpose01?sqlName=dlhw&url=exec T_GetRubbishDistanceInfo  '" + this.nowDate + "','" + this.ClientNo + "'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url);
      myChart.setOption({
        yAxis: {
          data: data.categories
        },
        series: [{
          name:'出动率',
          data: data.data
        }]
      });
    },
    //各清运队实时在线百分比
    async initWorkOnStandard_GZ () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_GZ'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(spotsNumbeH1());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetT1BarMultipurpose01?sqlName=dlhw&url=exec T_GetRubbishOnlineInfo '" + this.ClientNo + "'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url);
      myChart.setOption({
        yAxis: {
          data: data.categories
        },
        series: [{
          name:'在线率',
          data: data.data
        }]
      });
    },
    //中转站垃圾车辆作业趟次
    async initWorkOnStandard_ZV () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_ZV'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(spotsNumbe());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetT0BarMultipurpose01?sqlName=dlhw&url=exec T_GetRubbishWorkInfo  '" + this.nowDate + "','" + this.ClientNo + "','中转站'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url);
      myChart.setOption({
        xAxis: {
          data: data.categories
        },
        series: [{

          data: data.data
        }]
      });
    },
    //前端处置单位情况统计
    async initWorkOnStandard_VY () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_VY'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(collectionRate3());
      // var url = "http://111.160.78.62:5565/CompanyapiDFLSapi/DFBigScreen/GetVehicleWInfo?CLIENT_NO=00000";
      //  +localStorage.getItem("CLIENT_NO");
      // const { data } = await this.$Http.get(url)

      myChart.setOption({
        // legend:{data:["小区","饭店","企业"]},
        series: [{
          data: [
            { "value": 723, "name": "小区" },
            { "value": 552, "name": "饭店" },
            { "value": 350, "name": "企业" },]
        },]
      });
    },
    // 处理厂垃圾车辆作业趟次
    async initWorkOnStandard_CV () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_CV'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(spotsNumbe());
      var url = "http://111.160.78.62:9935/api/EChartsYX/GetT0BarMultipurpose01?sqlName=dlhw&url=exec T_GetRubbishWorkInfo  '" + this.nowDate + "','" + this.ClientNo + "','处理厂'"
      //  +localStorage.getItem("CLIENT_NO");
      const { data } = await this.$Http.get(url);
      myChart.setOption({
        xAxis: {
          data: data.categories
        },
        yAxis: {
          
        },
        series: [{
          name:'趟次',
          data: data.data
        }]
      });
    },
    // 垃圾点位收运覆盖率
    async initWorkOnStandard_LV () {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('WorkOnStandard_LV'));
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(spotsNumbe2());
      // var url = "http://111.160.78.62:9935/api/EChartsYX/GetT0BarMultipurpose01?sqlName=dlhw&url=exec T_GetRubbishWorkInfo  '" + this.nowDate + "','0000009','垃圾点位'"
      //  +localStorage.getItem("CLIENT_NO");
      // const { data } = await this.$Http.get(url);
      myChart.setOption({
        yAxis: {
          max: 100
        },
        xAxis: {
          data: ["东丽湖清运队","金桥清运队","军粮城清运队","无暇清运队","新立清运队","滨海建业清运队","机场清运队","民航清运队",
                 "丰年村清运队","华明清运队","华新清运队","金钟清运队","开发区清运队","万新清运队","张贵庄清运队"]
        },
        series: [{
          name:'完成率',
          data: ["98","98","98","96","89","86","82","76","73","70", "68","50","43","40","35"]
        },]
      });
    },

    changeOperationSummaryValue (index) {
      switch (index) {
        case 0:
          {
            this.changeOperationValue = "WorkOnStandard_CV";
          }
          break;
        case 1:
          {
            this.changeOperationValue = "WorkOnStandard_ZV";
          }
          break;
      }
      setTimeout(() => {
        this.changeOperationSummary(index);
      }, 50);
    },
    changeOperationSummary (index) {
      switch (index) {
        case 0:
          {
            this.initWorkOnStandard_CV();
            this.changeOperationName = "处理厂垃圾车辆作业趟次";
          }
          break;
        case 1:
          {
            this.initWorkOnStandard_ZV();
            this.changeOperationName = "中转站垃圾车辆作业趟次";
          }
          break;
      }
    },
    timeFn () {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss')
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd')
        this.dateWeek = this.weekday[new Date().getDay()]
      }, 1000)
    },
    cancelLoading () {
      setTimeout(() => {
        this.loading = false
        this.initC();
      }, 2000)
    },
  }
}
</script>

<style lang="scss">
@import '../assets/scss/index.scss';
//下方区域的布局
.content-box2 {
  grid-auto-flow: row dense;
  display: grid;
  grid-template-columns: repeat(4, 25%);
  grid-template-rows: repeat(4, 24%);
  grid-template-areas:
    // 'one two three four'
    // 'one two three four'
    // 'five six seven eight'
    // 'five six seven eight'
    // 'nine six  seven ten'
    // 'nine eleven  twelve ten'
    // 'thirteen eleven twelve fourteen'
    // 'thirteen eleven twelve fourteen';

    'ten six six eight'
    'one six six eight '
    'two seven seven  four'
    'fourteen seven seven four';
}
.one {
  margin: 5px;
  grid-area: one;
  background: rgba(8, 48, 74, 0.5);
}

.two {
  margin: 5px;
  grid-area: two;
  background: rgba(8, 48, 74, 0.5);
  // grid-row-start: span 2;
}
.three {
  margin: 5px;
  grid-area: three;
  background: rgba(8, 48, 74, 0.5);
}
.four {
  margin: 5px;
  grid-area: four;
  background: rgba(8, 48, 74, 0.5);
}
.five {
  margin: 5px;
  grid-area: five;
  background: rgba(8, 48, 74, 0.5);
}
.six {
  margin: 5px;
  grid-area: six;
  background: rgba(8, 48, 74, 0.5);
}
.seven {
  margin: 5px;
  grid-area: seven;
  background: rgba(8, 48, 74, 0.5);
}
.eight {
  margin: 5px;
  grid-area: eight;
  background: rgba(8, 48, 74, 0.5);
}
.nine {
  margin: 5px;
  grid-area: nine;
  background: rgba(8, 48, 74, 0.5);
}
.ten {
  margin: 5px;
  grid-area: ten;
  background: rgba(8, 48, 74, 0.5);
}
.eleven {
  margin: 5px;
  grid-area: eleven;
  background: rgba(8, 48, 74, 0.5);
}
.twelve {
  margin: 5px;
  grid-area: twelve;
  background: rgba(8, 48, 74, 0.5);
}
.thirteen {
  margin: 5px;
  grid-area: thirteen;
  background: rgba(8, 48, 74, 0.5);
}
.fourteen {
  margin: 5px;
  grid-area: fourteen;
  background: rgba(8, 48, 74, 0.5);
}
// 底部数据
.bototm-box {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, 50%);
}
.title {
  padding-top: 10px;
  padding-left: 20px;
  .text {
    font-size: 15px;
    color: #fff;
  }
}
.title-text {
  font-family: 'SimHei';
  font-weight: bold;
}

</style>

